﻿using System;
using Lucene.Net.Index;
using MetaCollection.Framework.Provider;
using MetaCollection.Framework.Repository;

namespace MetaCollection.Framework.Index
{
	/// <summary>
	/// This interface is used to handle the initialization of Repository Indexes.  The
	/// provider interface is included so that when initialized the index can be registered
	/// to be notified of changes to items in the system.
	/// </summary>
	interface IRepositoryIndex : IRepository, IProvider, IDisposable
	{
		/// <summary>
		/// Creates an index reader for this repository index.
		/// </summary>
		/// <returns>An index reader that can be used to search the index</returns>
		IndexReader CreateReader();
		/// <summary>
		/// Suspends any current indexing operations and prevents further data from
		/// being written to the index until ResumeIndexing() is called.  Change events
		/// may still be queued from provider sources.
		/// </summary>
		void SuspendIndexing();
		/// <summary>
		/// Resumes normal indexing operations.
		/// </summary>
		void ResumeIndexing();
		/// <summary>
		/// The current status of indexing operations
		/// </summary>
		RepositoryIndexStatus CurrentStatus { get; }
		/// <summary>
		/// The length of the queue of items pending index.
		/// </summary>
		int IndexQueueLength { get; }
	}
}
